package cn.wokoba.trigger.job;

import cn.wokoba.service.trade.service.ITradeSettlementOrderService;
import com.alibaba.fastjson.JSON;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@Slf4j
public class GroupBuyRefundJob {
    @Resource
    private ITradeSettlementOrderService tradeSettlementOrderService;

    @Scheduled(cron = "0/20 * * * * ?")
    public void exec() {
        try {
            Map<String, Integer> result = tradeSettlementOrderService.processFailedSettlementRefund();
            log.info("定时任务，超时拼团自动退款任务 result:{}", JSON.toJSONString(result));
        } catch (Exception e) {
            log.error("定时任务，超时拼团自动退款任务失败", e);
        }
    }
}
